from django.db import models
from users.models import User

class CacheRecord(models.Model):
    key = models.CharField(max_length=255, verbose_name="索引标签", blank=True, null=True,default="")
    key_type = models.CharField(max_length=100, verbose_name="索引标签类型", blank=True, null=True,default="")
    record = models.JSONField(default=dict, verbose_name="缓存的数据")
    class Meta:
        verbose_name = "CacheRecord"
        verbose_name_plural = "缓存记录"
        unique_together = ('key','key_type')
    def __str__(self):
        return f"{self.key}:{self.key_type}"
